package com.school.zhaoban.response;

public enum ResultCode {
    /**
     * 请求状态
     */
    HTTP_SUCCESS(200,"请求成功"),
    HTTP_FAIL(500,"请求失败"),
    HTTP_UNAUTHORIZED(401,"未授权"),
    HTTP_AUTHORIZATION_EXPIRED(403,"访问受限，授权过期"),
    HTTP_SERVICE_NOT_FOUND(404,"资源，服务未找到"),


    /**
     * 参数错误 1000-1999
     */
    PARAM_IS_BLANK(1001,"参数为空"),
    PARAM_IS_INVALID(1002,"参数无效"),
    PARAM_TYPE_BIND_ERROR(1003,"参数类型错误"),
    PARAM_NOT_COMPLETE(1004,"参数缺失"),

    /**
     * 用户错误 2000-2999
     */
    USER_NOT_LOGGED_IN(2000,"用户未登录，请重新登录"),
    USER_LOGIN_ERROR(2001,"账号不存在或密码错误"),
    USER_ACCOUNT_FORBIDDEN(2002,"账号已被禁用"),
    USER_NOT_EXIST(2003,"账号不存在"),
    USER_HAS_EXISTED(2004,"账号已存在"),
    USER_HAS_DELETE(2005,"账号已删除"),
    USER_AUTHORITY_NOT_EXIST(2006,"账号权限列表为空"),
    USER_PHONE_NOT_EXIST(2007,"手机号已使用"),
    USER_OPERATION_NOT_ALLOWED(2008,"不允许操作超级管理员用户"),


    ROLE_HAS_EXISTED(2009,"角色已存在"),

    /**
     * 异常处理 3000-3999
     */
    EXCEPTION_NUllPOINTER(3000,"空指针异常"),
    EXCEPTION_ClASS_NOT_FOUNT(3001,"指定的类不存在"),
    EXCEPTION_INDEX_OUT_OF_BOUNDS(3002,"数组下标越界异常"),
    EXCEPTION_ILLEGAL_ARGUMENT(3003,"方法的参数错误"),
    EXCEPTION_CLASS_CAST(3004,"数据类型转换异常"),
    EXCEPTION_FILE_NOT_FOUND(3005,"文件未找到异常"),
    EXCEPTION_ARRAY_STORE (3007,"数组存储异常"),
    EXCEPTION_UNKNOWN_ERROR (3008,"未知异常"),


    /**
     * 微信相关异常 4000-4100
     */
    GET_OPEN_ID_EXCEPTION(4000,"获取openId失败"),
    GET_TOKEN_ID_EXCEPTION(4001,"获取唯一授权码失败"),

    ;

    public int getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    /**
     * 状态码
     */
    private final Integer code;
    /**
     * 返回消息文本
     */
    private final String message;

    ResultCode(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer code(){
        return this.code;
    }
    public String message(){
        return this.message;
    }



}
